package com.dofast.bt.mvp.presenter.my;

import com.dofast.bt.adapter.CollectGoodsListAdapter;
import com.dofast.bt.adapter.MessageListAdapter;
import com.dofast.bt.adapter.SelectCallBack;
import com.dofast.bt.base.BaseMvpPresenter;
import com.dofast.bt.bean.GoodsBean;
import com.dofast.bt.mvp.view.activity.my.CollectGoodsListView;
import com.dofast.bt.mvp.view.activity.my.MessageListView;
import com.dofast.bt.util.Helper;

import java.util.ArrayList;
import java.util.List;

/**
 * username:Created by hsj on 2016/12/22 0022.
 * class：
 * 类描述：消息中心列表
 */

public class MessageListPresenter extends BaseMvpPresenter<MessageListView> implements IMessageListPresenter {
    private List<GoodsBean> list = null;
    private MessageListAdapter adapter = null;
    private GoodsBean goodsBean = null;

    @Override
    public void initData() {
        checkViewAttach();
        list = new ArrayList<GoodsBean>();
        adapter = new MessageListAdapter(list);
        goodsBean = new GoodsBean();
        mvpView.initAdapter(adapter);
        getData();

    }

    /**
     * 获取数据
     */
    private void getData() {

        GoodsBean good = new GoodsBean();
        good.setName("通知消息");
        good.setContent("好货备上了，让您久等了");
        list.add(good);
        GoodsBean good1 = new GoodsBean();
        good1.setName("意味茶馆");
        good1.setContent("谢谢关注本店");
        list.add(good1);
        GoodsBean good2 = new GoodsBean();
        good2.setName("茶两口");
        good2.setContent("今天发货，亲");
        list.add(good2);
        GoodsBean good3 = new GoodsBean();
        good3.setName("芳如故茶馆");
        good3.setContent("谢谢关注本店");
        list.add(good3);
        GoodsBean good4 = new GoodsBean();
        good4.setName("味之源茶庄");
        good4.setContent("下午发给你");
        list.add(good4);
        GoodsBean good5 = new GoodsBean();
        good5.setName("春轩堂");
        good5.setContent("给你发货了，请注意查收");
        list.add(good5);
        GoodsBean good6 = new GoodsBean();
        good6.setName("古秋茶庄");
        good6.setContent("您的货已在派送中");
        list.add(good6);
        GoodsBean good7 = new GoodsBean();
        good7.setName("品味茶社");
        good7.setContent("好货备上了，让您久等了");
        list.add(good7);

        adapter.notifyDataSetChanged();
    }

    @Override
    public void itemClick(int position) {
//        mvpView.showDetail();
//        mvpView.gotoActivity(StoreDetailActivity.class, false);
        //跳转到详情界面
        Helper.showToast("该功能暂未开放，敬请期待新版本！");
    }



    /**
     * @param position 删除消息
     */
    @Override
    public void delete(int position) {
        list.remove(position);
        adapter.notifyDataSetChanged();
    }
}
